/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.DAO;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import com.Entity.CompanyUser;

/**
 * 
 * @author KIS
 */
@Stateless
public class CompanyUserFacade extends AbstractFacade<CompanyUser> {
	@PersistenceContext(unitName = "ManTechHelpdesk-EjbPU")
	private EntityManager em;

	@Override
	protected EntityManager getEntityManager() {
		return em;
	}

	public CompanyUserFacade() {
		super(CompanyUser.class);
	}

	public CompanyUser findByLoginCode(String loginCode) {
		Query query = getEntityManager().createNamedQuery("CompanyUser.findByLoginCode", CompanyUser.class);
		query.setParameter("loginCode", loginCode);
		return (CompanyUser) query.getResultList().get(0);
	}
	
}
